package com.ydyyt.main;

import java.io.IOException;
import java.util.Scanner;

import com.ydyyt.realize.CallException;
import com.ydyyt.realize.Realize;

public class MyMenu {
	//初始化一个实现类
	Realize realize = new Realize();
	Scanner input = new Scanner(System.in);
	
	//一级菜单
	public void mainMenu() throws CallException, IOException {
		System.out.println("***************欢迎使用嗖嗖移动业务大厅**************");
		System.out.println("1、用户登录\t2、用户注册\t3、使用便民");
		System.out.println("4、话费充值\t5、资费说明\t3、退出系统");
		System.out.println("请选择：");
		int num = input.nextInt();
		switch(num){
		case 1:
			realize.login();
			mainMenu();
			break;
		case 2:
			realize.register();
			mainMenu();
			break;
		case 3:
			realize.search();
			break;
		case 4:
			realize.addCredit();
			mainMenu();
			break;
		case 5:
			realize.tariffDescription();
			break;
		case 6:
			System.out.println("您已成功退出系统，感谢你的使用！");
			System.exit(0);
		default:
			System.out.println("功能选择非法，请重新选择！");
			System.out.println("现已经自动退出系统，感谢您的使用！");
			System.exit(0);
		}
	}
	//二级菜单
	public void subMenu(String phoneNum) throws CallException, IOException {
		System.out.println("****************嗖嗖移动用户菜单*************");
		System.out.println("1、本月账单查询\n2、套餐余额查询\n3、打印消费详单\n4、套餐变更\n5、办理退网");
		System.out.println("请选择(输入1~5选择功能,其他键返回上一级)：");
		int num = input.nextInt();
		switch(num) {
		case 1:
			realize.billQuery(phoneNum);
			break;
		case 2:
			realize.balanceOfQuery(phoneNum);
			break;
		case 3:
			realize.printConsumeList(phoneNum);
			break;
		case 4:
			realize.packageChange(phoneNum);
			break;
		case 5:
			realize.handleOutNet(phoneNum);
			break;
		default:
			mainMenu();
			break;
		}
	}
}
